move set_cursor after realization of the popup window, so clamp node
authorMatthias Clasen <mclasen@redhat.com>
Fri, 5 Jan 2007 05:41:25 +0000 (05:41 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 5 Jan 2007 05:41:25 +0000 (05:41 +0000)
2007-01-04  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkcombobox.c (gtk_combo_box_popup): move set_cursor
        after realization of the popup window, so clamp node doesn't fail.
        (#346616, Tommi Komulainen, patch by Kristian Rietveld).

svn path=/trunk/; revision=17073

ChangeLog
gtk/gtkcombobox.c

index a617e1476a753817acbc67a76caf887d2f86bd61..2c6b9a4df65ae2237cfcf38ddcc72d177bec2f05 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-04  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_popup): move set_cursor
+       after realization of the popup window, so clamp node doesn't fail.
+       (#346616, Tommi Komulainen, patch by Kristian Rietveld).
+
 2007-01-04  Behdad Esfahbod  <behdad@gnome.org>
 
        * gtk/gtklabel.c (get_layout_location): Fix uninitialized width
index 23af2f8ae05e8f65dfc73b9e2f292121fb06b460..235a320400355723a2f365614d6dcd509560dea2 100644 (file)
@@ -1756,7 +1756,7 @@ static void
 gtk_combo_box_real_popup (GtkComboBox *combo_box)
 {
   gint x, y, width, height;
-  GtkTreePath *path, *ppath;
+  GtkTreePath *path = NULL, *ppath;
   GtkWidget *toplevel;
 
   if (!GTK_WIDGET_REALIZED (combo_box))
@@ -1789,9 +1789,6 @@ gtk_combo_box_real_popup (GtkComboBox *combo_box)
       if (gtk_tree_path_up (ppath))
        gtk_tree_view_expand_to_path (GTK_TREE_VIEW (combo_box->priv->tree_view),
                                      ppath);
-      gtk_tree_view_set_cursor (GTK_TREE_VIEW (combo_box->priv->tree_view),
-                               path, NULL, FALSE);
-      gtk_tree_path_free (path);
       gtk_tree_path_free (ppath);
     }
   gtk_tree_view_set_hover_expand (GTK_TREE_VIEW (combo_box->priv->tree_view), 
@@ -1800,6 +1797,13 @@ gtk_combo_box_real_popup (GtkComboBox *combo_box)
   /* popup */
   gtk_widget_show (combo_box->priv->popup_window);
 
+  if (path)
+    {
+      gtk_tree_view_set_cursor (GTK_TREE_VIEW (combo_box->priv->tree_view),
+                               path, NULL, FALSE);
+      gtk_tree_path_free (path);
+    }
+
   gtk_widget_grab_focus (combo_box->priv->popup_window);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (combo_box->priv->button),
                                 TRUE);